﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Frame.Lib.Data;

namespace Frame.Lib.Core.Log.Exceptions
{
    public partial class LogExceptionInfo : EntityBase
    {
        public override string GetTableName()
        {
            return "s_LogException";
        }
        public override string GetInsertSql()
        {
            return "insert into s_LogException ( [ID], [LoginName], [UserName], [InputTime], [ErrorMessage], [StackTrace], [Tag]) values ( @ID, @LoginName, @UserName, @InputTime, @ErrorMessage, @StackTrace, @Tag)";
        }
        public override string GetUpdateSql()
        {
            return "update s_LogException set [LoginName] = @LoginName, [UserName] = @UserName, [InputTime] = @InputTime, [ErrorMessage] = @ErrorMessage, [StackTrace] = @StackTrace, [Tag] = @Tag where ID = @ID";
        }
        /// <summary>
        /// 
        /// </summary>
        public Guid ID
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        public String LoginName
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        public String UserName
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime InputTime
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        public String ErrorMessage
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        public String StackTrace
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        public String Tag
        {
            get;
            set;
        }
        public override void SetValue(string key, object value)
        {
            key = key.ToLower();
            switch (key)
            {
                case "id":
                    this.ID = (Guid)value;
                    break;
                case "loginname":
                    this.LoginName = (String)value;
                    break;
                case "username":
                    this.UserName = (String)value;
                    break;
                case "inputtime":
                    this.InputTime = (DateTime)value;
                    break;
                case "errormessage":
                    this.ErrorMessage = (String)value;
                    break;
                case "stacktrace":
                    this.StackTrace = (String)value;
                    break;
                case "tag":
                    this.Tag = (String)value;
                    break;
            }
        }
        public override object GetValue(string key)
        {
            key = key.ToLower();
            switch (key)
            {
                case "id":
                    return this.ID;
                case "loginname":
                    return this.LoginName;
                case "username":
                    return this.UserName;
                case "inputtime":
                    return this.InputTime;
                case "errormessage":
                    return this.ErrorMessage;
                case "stacktrace":
                    return this.StackTrace;
                case "tag":
                    return this.Tag;
                default:
                    return null;
            }
        }
    }

}
